﻿@model IEnumerable<LyyCMS.Core.Models.Article>

@{
    ViewData["Title"] = "文章管理";
}

<div style="margin:10px;50px;">
    <a asp-action="Create">
        <i class="fas fa-pencil-alt">
        </i>新建
    </a>
</div>
<table class="table">
    <thead>
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.Title)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Category)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Click)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.ImgUrl)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Url)
            </th>
            
            <th>
                @Html.DisplayNameFor(model => model.SortId)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.CreationTime)
            </th>

            <th>
                @Html.DisplayNameFor(model => model.IsDeleted)
            </th>


            <th></th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.Title)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Category.Title)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Click)
                </td>
                <td>
                    @if (item.ImgUrl != "")
                    {
                        <img src="@Html.DisplayFor(modelItem => item.ImgUrl)" />
                    }
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Url)
                </td>
              
                <td>
                    @Html.DisplayFor(modelItem => item.SortId)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.CreationTime)
                </td>

                <td>
                    @Html.DisplayFor(modelItem => item.IsDeleted)
                </td>

                <td>
                    <a asp-action="Edit" asp-route-id="@item.Id">修</a> |
                    <a asp-action="Details" asp-route-id="@item.Id">看</a> |
                    <a asp-action="Delete" asp-route-id="@item.Id">删</a>
                </td>
            </tr>
        }
    </tbody>
</table>
